package com.supreme.studyserver.service.boot;

import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;

import java.util.concurrent.TimeUnit;

@Service
public class StopWatchService {

    public void test() {
        final StopWatch stopWatch = new StopWatch("1");
        stopWatch.start();

        try {
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        stopWatch.stop();
        final String prettyPrint = stopWatch.prettyPrint();
        System.out.println(prettyPrint);
        System.out.println(stopWatch.getTotalTimeSeconds());
    }
}
